<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script>
        var numberObject = new Number(10);
        var num = 10;
        console.log(num.valueOf()); //10 
        console.log(num.toString()); //"10" 默认十进制
        console.log(num.toString(2)); //"1010" ，此处为2进制
        console.log(num.toString(8)); //"12" 
        console.log(num.toString(10)); //"10"//此处为10进制
        //【1-1】toFixed() 方法可把 Number 四舍五入为指定小数位数的数字。
        var num = 10;
        console.log(num.toFixed(2)); //"10.00"
        var num = 10.005;
        console.log(num.toFixed(2)); //"10.01"
        //【1-2】toExponential() 方法可把对象的值转换成指数计数法。
        var num = 10;
        console.log(num.toExponential(1)); //"1.0e+1" 
        //【1-3】toPrecision() 方法可在对象的值超出指定位数时将其转换为指数计数法。
        var num = 99;
        console.log(num.toPrecision(1)); //"1e+2" 
        console.log(num.toPrecision(2)); //"99" 
        console.log(num.toPrecision(3)); //"99.0"
        //而这三个方法都可以通过向上或向下舍入做到以最准确的形式来表示带有正确小数位。
        //【2】类型检测和直接实例化的关系
        var numberObject = new Number(10);
        var numberValue = 10;
        console.log(typeof numberObject); //"object" 
        console.log(typeof numberValue); //"number" 
        console.log(numberObject instanceof Number); //true 
        console.log(numberValue instanceof Number); //false
    </script>
</body>

</html>